// @ts-check
var loadStatus = 0;
/**
 * @type {JQueryDeferred<void>}
 */
var defer = $.Deferred(); // 新建一个deferred对象
/**
 * @param {JQueryDeferred<void>} defer
 */
function wait(defer) {
  window.setTimeout(tasks(defer), 2000);
  return defer;
}
/**
 * @type {JQuery<HTMLProgressElement>}
 */

var progress = $("progress");
/**
 * @param {number} value
 */
var updateProgress = function (value) {
  progress.val(value);
  progress.text(value + "%");
};
var __value = 0;
/**
 * @param {JQueryDeferred<void>} defer
 */
function tasks(defer) {
  return function () {
    alert("执行完毕！");
    defer.resolve(); // 改变deferred对象的执行状态
  };
}

function effect() {
  $.when(wait(defer))
    .done(function () {
      alert("哈哈，成功了！");
    })
    .fail(function () {
      alert("出错啦！");
    });
}
